layui.config({
	base : "js/"
}).use(['form','layer','jquery'],function(){
	var form = layui.form,
		layer = parent.layer === undefined ? layui.layer : parent.layer,
		layedit = layui.layedit,
		laydate = layui.laydate,
		$ = layui.jquery;

 	var addLinksArray = [],addLinks;
 	form.on("submit(addLinks)",function(data){
 		addLinks = '{"name":"'+ $(".name").val() +'",';  //网站名称
 		addLinks += '"sort":"'+ $(".sort").val() +'",';	 //网站地址
 		addLinks += '"categoryId":"'+ $(".categoryId").val() +'",';	 //网站地址
 		addLinks += '"description":"'+ $(".description").val() +'",'; //站点描述
 		addLinks += '"type":"'+ $(".type").val() +'"}';  //类别
        $.post({
            url : "/admin/addOrUpdateSinglePage",
            data : addLinks,
            contentType : "application/json", //必须，告诉服务器这是json
            success : function(resp){
                //layer.close(index);
                if(resp.code == '0'){
                    parent.layer.msg('修改成功', {icon: 1});
                    layer.closeAll('iframe');
                }else{
                    layer.msg(resp.msg);
                }
            }
        });
 		return false;
 	})
	
})
